//---------------------------------------------------------------------------

#ifndef HeadH
#define HeadH

////////////////////////////////////////////////////////////////////////////////////////////////////
// Defination for head mode
////////////////////////////////////////////////////////////////////////////////////////////////////
#define HEAD_STOP                  1
#define HEAD_GO_SLOW               2
#define HEAD_GO_MIDDLE             3
#define HEAD_GO_FAST               4
#define HEAD_SEARCH_UPPER          5
#define HEAD_SEARCH_CENTER         6
#define HEAD_SEARCH_LOWER          7
#define HEAD_SEARCH_UPPER_CENTER   8
#define HEAD_SEARCH_HALF_R         9
#define HEAD_SEARCH_HALF_L        10
#define HEAD_SEARCH_RADIATION_R   11
#define HEAD_SEARCH_RADIATION_L   12

typedef enum
{
	NONE_HEAD 				= 0,
	RU 								= 1,
	LU 								= 2,
	RC 								= 3,
	LC 								= 4,
	RL 								= 5,
	LL 								= 6,
	SEARCH_POINT_NUM	= 6
}	HeadStateDef;

typedef struct
{
	unsigned char Mode;
	unsigned char Mode_RX;
	unsigned char Mode_Past;
 	unsigned char Pos[2][2];

	HeadStateDef StateMode;
	unsigned char StateIndex;
}	HeadMotionStruct;

extern HeadMotionStruct Head;

void Head_Init(void);
void HeadMotion(void);
void HeadSearch(int head_0_now, int head_1_now, unsigned char SpeedL, unsigned char SpeedH, unsigned char head_wait_count, HeadStateDef *Type, int size);
int CheckHeadPosition(int head_0_now, int head_1_now, HeadStateDef *Type, int size);
void ScanByHead(unsigned char SpeedL, unsigned char SpeedH, unsigned char head_wait_count);
//---------------------------------------------------------------------------
#endif
